﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace VehicleManagement.Models
{
    //    CREATE TABLE CarParts
    //(
    //    PartID int PRIMARY KEY IDENTITY(1,1),
    //    CarID int REFERENCES CarInfo(CarID),
    //    DriverID int REFERENCES DriverInfo(DriverID),
    //    Date DateTime NOT NULL,
    //    TickID nvarchar(18) unique not null,
    //    Part nvarchar(30) not null,
    //    PartCompany nvarchar(30), 
    //    Price decimal(18,2) DEFAULT 0,
    //    Num int,
    //    Cost decimal(18,2) DEFAULT 0,
    //    Approval bit,
    //   Remark  char(100),

    //)

    public class CarParts
    {

        public int PartID { get; set; }
   
        public int CarID { get; set; }
     
        public int DriverID { get; set; }


        [DisplayName("车牌号码")]
        [Required(ErrorMessage = "车牌号不能为空")]
        [StringLength(100, ErrorMessage = "车牌号不能超过18位")]
        public virtual string CarNumber { get; set; }

        [DisplayName("司机姓名")]
        [Required(ErrorMessage = "姓名不能为空")]
        [StringLength(18, ErrorMessage = "姓名不能超过18位")]
        public virtual string DriverName { get; set; }

        [DisplayName("购买日期")]
       // [Required(ErrorMessage = "购买日期不能为空")]
        public DateTime Date { get; set; }

        [DisplayName("发票号码")]
       // [Required(ErrorMessage = "发票号码不能为空")]
        [StringLength(18, ErrorMessage = "号码不能超过18位")]
        public string TickID { get; set; }

        [DisplayName("购件名称")]
        [Required(ErrorMessage = "名称不能为空")]
       // [StringLength(30 , ErrorMessage = "购件名称长度不能超过30位")]
        public string Part { get; set; }

        [DisplayName("购件公司")]
       // [Required(ErrorMessage = "购件公司不能为空")]
        [StringLength(30, ErrorMessage = "公司不能超过30位")]
        public string PartCompany { get; set; }

        [DisplayName("单价")]
      // [Required(ErrorMessage = "价格不能为空")]
        public decimal Price { get; set; }

        [DisplayName("数量")]
       // [Required(ErrorMessage = "数量不能为空")]
        public int Num { get; set; }

        [DisplayName("配件总额")]
       // [Required(ErrorMessage = "总额不能为空")]
        public decimal Cost { get; set; }

        [DisplayName("是否审批")]
        public bool Approval { get; set; }

        [DisplayName("备注")]
        [StringLength(100, ErrorMessage = "备注不能超过100位")]
        public string Remark { get; set; }

        public string CompanyName { get; set; }


    }
}